/*
 * @Descripttion: 购物车数据模型
 * @version: 
 * @Author: 一氧化二氢
 * @Date: 2022-01-04 00:27:11
 * @lastEditorTime: Do no edit
 */
//导入seruelize的连接
const { DataTypes } = require('sequelize')
const seq = require('../db/seq')
//定义数据模型
const Cart = seq.define('zd_cart', {
    goods_id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        comment: '商品的id'
    },
    user_id: {
        type: DataTypes.INTEGER,
        allowNull: false,
        comment: '用户的id'
    },
    number: {
        type: DataTypes.INTEGER,
        allowNull: false,
        defaultValue: 1,
        comment: '商品的数量'
    },
    selected: {
        type: DataTypes.BOOLEAN,
        allowNull: false,
        defaultValue: true,
        comment: '是否选中'
    },
})

// Cart.sync({force:true})

module.exports = Cart